﻿using System;
using System.Collections.Generic;

using SBPweb.Forge.Contracts.Extensibility;

namespace SBPweb.PROvibe.Business.Shared.Contracts.Content
{

    public class ContainerDescriptor : IExtendable
    {

        #region Private fields

        private Dictionary<string, object> values = new Dictionary<string, object>();

        #endregion

        #region Constructor logic

        public ContainerDescriptor()
        {

        }

        public ContainerDescriptor(string containerId)
        {
            this.ContainerId = containerId;
        }

        #endregion

        #region Property accessors

        public string ContainerId
        {
            get
            {
                return Get<string>("ContainerId");
            }
            set
            {
                Put<string>("ContainerId", value);
            }
        }

        #endregion

        #region Methods

        public override bool Equals(object obj)
        {
            ContainerDescriptor cD = obj as ContainerDescriptor;
            return this.ContainerId.Equals(cD.ContainerId);
        }

        public override int GetHashCode()
        {
            return this.ContainerId.GetHashCode();
        }

        public bool Contains(string propertyName)
        {
            return values.ContainsKey(propertyName);
        }

        public T Get<T>(string propertyName)
        {
            return (T)values[propertyName];
        }

        public void Put<T>(string propertyName, T value)
        {
            values[propertyName] = value;
        }

        #endregion
    }

}